/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Serial;

import java.util.Scanner;



/**
 *
 * @author senior_design
 */
public class TestSerialEvent {
    
        public static void main(String[] args) {
        
        try
        {
            //(new SerialEvent()).connect("COM3");
//            SerialEvent test =new SerialEvent();
//            test.connect("COM3");
            SerialTest test = new SerialTest();
            test.initialize();
//            byte t[] ={1,16,15,(byte)128,(byte)200,90,1};
//            for(int j =0;j<t.length;j++){
//            System.out.println(Integer.toHexString(t[j]&0xFF));}
            Scanner scan = new Scanner(System.in);
            byte a[]={0x02,0x63,0x16,0x00};
            byte b[]={0x02,0x63,0x12,(byte) 0x80};
            try {
		       Thread.sleep(2000);  // Be sure data is xferred before closing
		    } catch (Exception e) {}
            test.write(a);
            int i = 0;
            while(i!=5)
            {
                
                System.out.println("enter number");
                i=scan.nextInt();
                System.out.println(i);
                test.write(b);
            }
            test.close();
            
        }
        catch ( Exception e )
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
            
//         Serial tgif= new Serial();
//         tgif.xOff('E', 1);
        
    }
    
}
    

